﻿using UnityEngine;
using System.Collections;

public delegate void PluginEffect(EnemyTakeDamage other);
public class Ammo : MonoBehaviour {
    PluginEffect effectFirst = null;
    PluginEffect effectSecond = null;

    Vector3 direction;
    float lifeTime;
    int canHurtEnemyNum;
    float speed;

	// Use this for initialization
	void Start () {
	}
	
	// Update is called once per frame
	void Update () {
        if(lifeTime <= 0)
        {
            gameObject.SetActive(false);
            return;
        }
        lifeTime -= Time.deltaTime;

        move();
	}

    public void init()
    {

    }

    private void move()
    {
        transform.position += direction * speed;
        //添加拖尾效果
    }  

    private void explode()
    {

    }


    ////事后添加场景破坏
    //public void OnTriggerEnter2D(Collider2D collision)
    //{
    //    if (collision.gameObject.tag == "platform")
    //    {
    //        gameObject.SetActive(false);
    //        return;
    //    }

    //    if (collision.gameObject.tag == "enemy")
    //    {
    //        if (effectFirst != null)
    //            effectFirst(collision.GetComponent<EnemyTakeDamage>());
    //        if (effectSecond != null)
    //            effectFirst(collision.GetComponent<EnemyTakeDamage>());

    //        if(canHurtEnemyNum == -1)
    //        {
    //            return;
    //        }
    //        canHurtEnemyNum -= 1;
    //        if(canHurtEnemyNum == 0)
    //        {
    //            gameObject.SetActive(false);
    //            return;
    //        }
    //    }
    //}
}
